package com.tjcd.project.library_base.common.basicInfor;

import android.text.TextUtils;

import androidx.annotation.Keep;

import com.blankj.utilcode.util.SPStaticUtils;

/**
 * @Author jiangKunKun
 * @CreateDate 2021/7/7
 * @Description 用户基础信息存储
 * @SpittingGrooves
 */
@Keep
public class SugarSpConst {
    /**
     * 用户 token
     */
    private final static String TOKEN = "Token";
    /**
     * 用户 手机号
     */
    private final static String PHONE = "Phone";
    /**
     * 用户 id
     */
    private final static String MEMBERID = "MemberId";
    /**
     * 用户 名称
     */
    private final static String NICKNAME = "Nickname";
    /**
     * 用户 头像
     */
    private final static String AVATAR = "Avatar";
    /**
     * 用户 地区
     */
    private final static String AREA = "Area";

    /**
     * 用户 id
     */
    public static String getToken() {
        return TextUtils.isEmpty(SPStaticUtils.getString(TOKEN)) ? "" : SPStaticUtils.getString(TOKEN);
    }

    public static void setToken(String token) {
        SPStaticUtils.put(TOKEN, token);
    }

    /**
     * 用户 id
     */
    public static String getPhone() {
        return TextUtils.isEmpty(SPStaticUtils.getString(PHONE)) ? "" : SPStaticUtils.getString(PHONE);
    }

    public static void setPhone(String phone) {
        SPStaticUtils.put(PHONE, phone);
    }

    /**
     * 用户 id
     */
    public static String getMemberId() {
        return TextUtils.isEmpty(SPStaticUtils.getString(MEMBERID)) ? "" : SPStaticUtils.getString(MEMBERID);
    }

    public static void setMemberId(String memberid) {
        SPStaticUtils.put(MEMBERID, memberid);
    }

    /**
     * 用户 名称
     * @return
     */
    public static String getNickname() {
        return TextUtils.isEmpty(SPStaticUtils.getString(NICKNAME)) ? "" : SPStaticUtils.getString(NICKNAME);
    }

    public static void setNickname(String nickname) {
        SPStaticUtils.put(NICKNAME, nickname);
    }

    /**
     * 用户 头像
     * @return
     */
    public static String getAvatar() {
        return TextUtils.isEmpty(SPStaticUtils.getString(AVATAR)) ? "" : SPStaticUtils.getString(AVATAR);
    }

    public static void setAvatar(String avatar) {
        SPStaticUtils.put(AVATAR, avatar);
    }

    /**
     * 用户 地区
     * @return
     */
    public static String getArea() {
        return TextUtils.isEmpty(SPStaticUtils.getString(AREA)) ?  "" : SPStaticUtils.getString(AREA);
    }

    public static void setArea(String area) {
        SPStaticUtils.put(AREA, area);
    }
}
